package Thread.Thread_Attributes;

//线程的名字可以自定义，并不会对线程的执行有影响，可以方便在代码出故障进行调试的时候方便查看是哪个线程出问题了
public class Demo6 {
    public static void main(String[] args) {
        Thread t=new Thread(() -> {
            while(true){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"我是一个自定义的线程");

        t.start();
        while(true){
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
